<template>
  <div class="je-admin-layout-page-iframe">
    <iframe
      ref="el"
      scrolling="auto"
      frameborder="0"
      width="100%"
      height="100%"
      :src="url"
    ></iframe>
  </div>
</template>
<script>
  import { defineComponent, ref } from 'vue';
  import { toTemplate } from '@jecloud/utils';
  export default defineComponent({
    name: 'AdminPageMicro',
    props: { menu: Object },
    emits: ['success', 'error'],
    setup(props) {
      const el = ref();
      const url = ref(props.menu.configInfo);
      // 从配置里面获得地址
      if (props.menu.configInfo) {
        const array = props.menu.configInfo.split(',');
        if (array.length > 1) {
          url.value = toTemplate(array[1]);
        }
      }
      return { el, url };
    },
  });
</script>
<style lang="less">
  .je-admin-layout-page-iframe {
    height: 100%;
  }
</style>
